Fix/write vhdl shift pos operand types - #233
Merged
tgingold merged 2 commits intoJun 22, 2026
Merged
Conversation
… errors
Three bugs in shift and $pos operand wrapping, all with the same root cause:
the handlers called dump_sigspec() directly on operands that require
dump_sigspec_unsigned/signed to produce legal VHDL-93.
t_shift_const: $shl/$shr/$sshl/$sshr with constant shift amount
to_integer(unsigned("000...001")) -- string literal is not a valid
type conversion operand. Refs ghdl#230.
t_shift_1bit: $shl/$shr with 1-bit signal shift amount
to_integer(unsigned(sig)) where sig is std_logic -- unsigned()
requires std_logic_vector. Refs ghdl#231.
t_pos_1bit: $pos extending a 1-bit signal (A_WIDTH=1, Y_WIDTH>1)
resize(unsigned(data), N) where data is std_logic -- same type
mismatch. Refs ghdl#232.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
ghdl#232) Three related bugs in operand wrapping: the shift handlers and $pos called dump_sigspec() directly on operands that require dump_sigspec_unsigned/signed to handle 1-bit signals and constants. $shl/$shr/$sshl/$sshr, $shift, $shiftx (B operand): to_integer(unsigned("000...1")) -- string literal not a valid type conversion operand in VHDL-93. Refs ghdl#230. to_integer(unsigned(sig)) where sig is std_logic. Refs ghdl#231. Fix: use dump_sigspec_unsigned/signed for B throughout. $shl/$shr/$sshl/$sshr (A operand): unsigned(flag) where flag is std_logic. Fix: use dump_sigspec_unsigned/signed for A. $pos (A operand, a_width != y_width): resize(unsigned(data), N) where data is std_logic. Also fixes y_width==1 type mismatch via arith_open/close. Refs ghdl#232. Also extends t_shift_1bit.v to cover 1-bit A (shift of a std_logic value), and updates testsuite.sh comment to reflect the broader scope. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #230
Closes #231
Closes #232
write_vhdl: fix shift and $pos operand type errors